package com.multi.thread.chapter01;

public class StopBySleepThread extends Thread {

	@Override
	public void run() {
		try {
			for (int i = 0; i < 100; i++) {
				System.out.println("i = " + (i + 1));
			}
			System.err.println("run begin!");
			Thread.sleep(2000);
			System.err.println("run end!");
		} catch (InterruptedException e) {
			System.err.println("先停止，再遇到sleeep!进入了catch");
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		StopBySleepThread thread = new StopBySleepThread();
		thread.start();
		thread.interrupt();
		System.out.println("end!");
	}

}
